/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Ingresar_alumno.java
 *
 * Created on 20/07/2011, 11:50:35 PM
 */
package bufete;

//import Cliente.NuevoCliente;
import Cliente.NuevoCliente;
import callProcs.ProcsAlumno;
import callProcs.ProcsInsertar;
import java.math.BigInteger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Javier
 */
public class Ingresar_alumno extends javax.swing.JFrame {
    private int idDpto;
        ProcsInsertar alumno = new ProcsInsertar();
    /** Creates new form Ingresar_alumno */
    public Ingresar_alumno() {
        initComponents();
        int idDpto;

                try {
            java.sql.ResultSet rs= alumno.verDepartementos();
            while (rs.next()){
                cb_dpto.addItem(rs.getObject("Nombre_departamento"));
            }
        } catch (SQLException ex) {
           // Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Cedula_DPI = new javax.swing.JPanel();
        l_NoRegistro = new javax.swing.JLabel();
        t_Registro = new javax.swing.JTextField();
        cb_NoOrden = new javax.swing.JComboBox();
        l_NoOrden = new javax.swing.JLabel();
        l_Cedula_DPI = new javax.swing.JLabel();
        l_NoDPI = new javax.swing.JLabel();
        t_NoDPI = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        cb_dpto = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        cb_muni = new javax.swing.JComboBox();
        t_Direccion = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        t_Zona = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        l_NoCarne = new javax.swing.JLabel();
        t_NoCarne = new javax.swing.JTextField();
        l_Nombres = new javax.swing.JLabel();
        t_Nombres = new javax.swing.JTextField();
        l_Apellidos = new javax.swing.JLabel();
        t_Apellidos = new javax.swing.JTextField();
        l_FechaNac = new javax.swing.JLabel();
        cb_dia = new javax.swing.JComboBox();
        cb_mes = new javax.swing.JComboBox();
        cb_año = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        l_EstadoCivil = new javax.swing.JLabel();
        rb_Soltero = new javax.swing.JRadioButton();
        rb_Casado = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        t_Casa = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        t_Cel = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bufete.BufeteApp.class).getContext().getResourceMap(Ingresar_alumno.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        Cedula_DPI.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        Cedula_DPI.setName("Cedula_DPI"); // NOI18N

        l_NoRegistro.setText(resourceMap.getString("l_NoRegistro.text")); // NOI18N
        l_NoRegistro.setName("l_NoRegistro"); // NOI18N

        t_Registro.setText(resourceMap.getString("t_Registro.text")); // NOI18N
        t_Registro.setName("t_Registro"); // NOI18N
        t_Registro.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_RegistroKeyTyped(evt);
            }
        });

        cb_NoOrden.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "A-01", "B-02", "C-03", "D-04", "E-05", "F-06", "G-07", "H-08", "I-09", "J-10", "K-11", "L-12", "M-13", "N-14", "O-15", "P-16", "Q-17", "R-18", "S-19", "T-20", "U-21", "V-22" }));
        cb_NoOrden.setName("cb_NoOrden"); // NOI18N
        cb_NoOrden.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cb_NoOrdenActionPerformed(evt);
            }
        });

        l_NoOrden.setText(resourceMap.getString("l_NoOrden.text")); // NOI18N
        l_NoOrden.setName("l_NoOrden"); // NOI18N

        l_Cedula_DPI.setFont(resourceMap.getFont("l_Cedula_DPI.font")); // NOI18N
        l_Cedula_DPI.setText(resourceMap.getString("l_Cedula_DPI.text")); // NOI18N
        l_Cedula_DPI.setName("l_Cedula_DPI"); // NOI18N

        l_NoDPI.setText(resourceMap.getString("l_NoDPI.text")); // NOI18N
        l_NoDPI.setName("l_NoDPI"); // NOI18N

        t_NoDPI.setText(resourceMap.getString("t_NoDPI.text")); // NOI18N
        t_NoDPI.setName("t_NoDPI"); // NOI18N
        t_NoDPI.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_NoDPIKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout Cedula_DPILayout = new javax.swing.GroupLayout(Cedula_DPI);
        Cedula_DPI.setLayout(Cedula_DPILayout);
        Cedula_DPILayout.setHorizontalGroup(
            Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Cedula_DPILayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(l_Cedula_DPI)
                    .addGroup(Cedula_DPILayout.createSequentialGroup()
                        .addGroup(Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(l_NoOrden)
                            .addComponent(l_NoDPI))
                        .addGap(27, 27, 27)
                        .addGroup(Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(Cedula_DPILayout.createSequentialGroup()
                                .addComponent(cb_NoOrden, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(37, 37, 37)
                                .addComponent(l_NoRegistro)
                                .addGap(18, 18, 18)
                                .addComponent(t_Registro, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(t_NoDPI))))
                .addContainerGap(368, Short.MAX_VALUE))
        );
        Cedula_DPILayout.setVerticalGroup(
            Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Cedula_DPILayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(l_Cedula_DPI)
                .addGap(15, 15, 15)
                .addGroup(Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(l_NoOrden)
                    .addComponent(cb_NoOrden, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(l_NoRegistro)
                    .addComponent(t_Registro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(29, 29, 29)
                .addGroup(Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(l_NoDPI)
                    .addComponent(t_NoDPI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(25, Short.MAX_VALUE))
        );

        jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setToolTipText(resourceMap.getString("jButton1.toolTipText")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        cb_dpto.setName("cb_dpto"); // NOI18N
        cb_dpto.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cb_dptoItemStateChanged(evt);
            }
        });
        cb_dpto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cb_dptoActionPerformed(evt);
            }
        });

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        cb_muni.setName("cb_muni"); // NOI18N
        cb_muni.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cb_muniActionPerformed(evt);
            }
        });

        t_Direccion.setName("t_Direccion"); // NOI18N

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
        jLabel20.setName("jLabel20"); // NOI18N

        t_Zona.setText(resourceMap.getString("t_Zona.text")); // NOI18N
        t_Zona.setName("t_Zona"); // NOI18N
        t_Zona.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_ZonaKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addGap(39, 39, 39)
                        .addComponent(t_Direccion, javax.swing.GroupLayout.PREFERRED_SIZE, 416, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(t_Zona, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cb_dpto, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(cb_muni, 0, 319, Short.MAX_VALUE)))
                    .addComponent(jLabel1))
                .addContainerGap(179, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addGap(17, 17, 17)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(cb_dpto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(cb_muni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(t_Direccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel15)
                        .addComponent(t_Zona, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel20)))
                .addContainerGap(40, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel2.setName("jPanel2"); // NOI18N

        l_NoCarne.setText(resourceMap.getString("l_NoCarne.text")); // NOI18N
        l_NoCarne.setName("l_NoCarne"); // NOI18N

        t_NoCarne.setText(resourceMap.getString("t_NoCarne.text")); // NOI18N
        t_NoCarne.setName("t_NoCarne"); // NOI18N
        t_NoCarne.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                t_NoCarneActionPerformed(evt);
            }
        });
        t_NoCarne.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_NoCarneKeyTyped(evt);
            }
        });

        l_Nombres.setText(resourceMap.getString("l_Nombres.text")); // NOI18N
        l_Nombres.setName("l_Nombres"); // NOI18N

        t_Nombres.setText(resourceMap.getString("t_Nombres.text")); // NOI18N
        t_Nombres.setName("t_Nombres"); // NOI18N

        l_Apellidos.setText(resourceMap.getString("l_Apellidos.text")); // NOI18N
        l_Apellidos.setName("l_Apellidos"); // NOI18N

        t_Apellidos.setText(resourceMap.getString("t_Apellidos.text")); // NOI18N
        t_Apellidos.setName("t_Apellidos"); // NOI18N

        l_FechaNac.setText(resourceMap.getString("l_FechaNac.text")); // NOI18N
        l_FechaNac.setName("l_FechaNac"); // NOI18N

        cb_dia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        cb_dia.setName("cb_dia"); // NOI18N

        cb_mes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));
        cb_mes.setName("cb_mes"); // NOI18N

        cb_año.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027", "2028", "2029", "2030", "2031", "2032", "2033", "2034", "2035", "2036", "2037", "2038", "2039", "2040", "2041", "2042", "2043", "2044", "2045", "2046", "2047", "2048", "2049", "2050" }));
        cb_año.setName("cb_año"); // NOI18N

        jLabel5.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setIcon(resourceMap.getIcon("jLabel6.icon")); // NOI18N
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(l_Nombres)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(t_Nombres))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 1, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(l_NoCarne)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(t_NoCarne, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(l_Apellidos)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(t_Apellidos, javax.swing.GroupLayout.PREFERRED_SIZE, 398, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 1, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(l_FechaNac)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cb_dia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(34, 34, 34)
                        .addComponent(cb_mes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31)
                        .addComponent(cb_año, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 187, Short.MAX_VALUE)
                .addComponent(jLabel6)
                .addGap(62, 62, 62))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(276, 276, 276)
                .addComponent(jLabel5)
                .addContainerGap(419, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(l_NoCarne)
                    .addComponent(t_NoCarne, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(l_Nombres)
                    .addComponent(t_Nombres, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(l_Apellidos)
                    .addComponent(t_Apellidos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cb_dia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cb_año, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cb_mes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(l_FechaNac))
                .addGap(25, 25, 25))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel3.setName("jPanel3"); // NOI18N

        l_EstadoCivil.setFont(resourceMap.getFont("l_EstadoCivil.font")); // NOI18N
        l_EstadoCivil.setText(resourceMap.getString("l_EstadoCivil.text")); // NOI18N
        l_EstadoCivil.setName("l_EstadoCivil"); // NOI18N

        rb_Soltero.setText(resourceMap.getString("rb_Soltero.text")); // NOI18N
        rb_Soltero.setName("rb_Soltero"); // NOI18N
        rb_Soltero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rb_SolteroActionPerformed(evt);
            }
        });

        rb_Casado.setText(resourceMap.getString("rb_Casado.text")); // NOI18N
        rb_Casado.setName("rb_Casado"); // NOI18N
        rb_Casado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rb_CasadoActionPerformed(evt);
            }
        });

        jLabel4.setFont(resourceMap.getFont("jLabel4.font")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N

        t_Casa.setName("t_Casa"); // NOI18N
        t_Casa.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_CasaKeyTyped(evt);
            }
        });

        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N

        t_Cel.setName("t_Cel"); // NOI18N
        t_Cel.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_CelKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addGap(29, 29, 29)
                        .addComponent(t_Casa, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(t_Cel, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel4)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(l_EstadoCivil)
                        .addGap(42, 42, 42)
                        .addComponent(rb_Soltero)
                        .addGap(38, 38, 38)
                        .addComponent(rb_Casado)))
                .addContainerGap(320, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(rb_Casado)
                    .addComponent(rb_Soltero)
                    .addComponent(l_EstadoCivil))
                .addGap(22, 22, 22)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jLabel19)
                    .addComponent(t_Cel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(t_Casa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(18, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(46, 46, 46)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(Cedula_DPI, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(26, 26, 26))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(Cedula_DPI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void t_NoCarneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_t_NoCarneActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_t_NoCarneActionPerformed

    private void t_NoCarneKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_NoCarneKeyTyped
        char caracter = evt.getKeyChar();
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE)))
        {
           evt.consume();  
        }  
    }//GEN-LAST:event_t_NoCarneKeyTyped

    private void t_RegistroKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_RegistroKeyTyped
        char caracter = evt.getKeyChar();
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE)))
        {
           evt.consume();  
        }
    }//GEN-LAST:event_t_RegistroKeyTyped

    private void t_NoDPIKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_NoDPIKeyTyped
        char caracter = evt.getKeyChar();
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE)))
        {
           evt.consume();  
        }
    }//GEN-LAST:event_t_NoDPIKeyTyped

    private void rb_SolteroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rb_SolteroActionPerformed
        if(rb_Soltero.isSelected() == true)
        {
            rb_Casado.setSelected(false);
        }
    }//GEN-LAST:event_rb_SolteroActionPerformed

    private void rb_CasadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rb_CasadoActionPerformed
        if(rb_Casado.isSelected() == true)
        {
            rb_Soltero.setSelected(false);
        }
    }//GEN-LAST:event_rb_CasadoActionPerformed

    private void cb_NoOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_NoOrdenActionPerformed
        if(cb_NoOrden.isFocusable() == true)
        {
            t_NoDPI.setEnabled(false);
        }
    }//GEN-LAST:event_cb_NoOrdenActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        
        boolean listo = true;
         if ((t_Nombres.getText().isEmpty() == true) ||(t_Apellidos.getText().isEmpty() == true) || (t_NoCarne.getText().isEmpty() == true)
           || ((cb_NoOrden.isFocusable() == false) && (t_NoDPI.getText().isEmpty() == true)) ||  ((rb_Soltero.isSelected() == false) && (rb_Casado.isSelected() == false))    
           || (t_Zona.getText().isEmpty() == true) || (t_Direccion.getText().isEmpty() == true))
                {
                    JOptionPane.showMessageDialog(null, "Los campos deben estar llenos"); listo = false;
                } 
        ResultSet rs;
        if (listo == true)
        {
            SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
            Date d = null;
            boolean ec = false;
            String fechaNac = cb_año.getSelectedItem().toString() + "-" + cb_mes.getSelectedItem().toString()+ "-" + cb_dia.getSelectedItem().toString();
//            try {
//            d = sdf.parse(fechaNac);
//             } catch (ParseException ex) {
////            Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
//            }
            if (rb_Soltero.isSelected() == true) ec = true;
            if (rb_Casado.isSelected() == true) ec = false;
            
            if (listo == true)
            {
                try 
                {
                    ProcsAlumno alumno = new ProcsAlumno();
                    int idMuni = 0, max = 0;
                    int dep = cb_dpto.getSelectedIndex();
                    String name_muni = cb_muni.getSelectedItem().toString();
                    
                    rs = alumno.ObtenerMuni(dep + 1, name_muni);
                    while (rs.next())
                    {
                        idMuni = Integer.parseInt(rs.getObject("idMunicipio").toString());
                    
                    }    
                    alumno.InsertaDirecAlumno(t_Direccion.getText(), Integer.parseInt(t_Zona.getText()), idMuni);
                    
                    rs = alumno.MaximaDireccion();
                    while (rs.next())
                    {
                        max = Integer.parseInt(rs.getObject("max(idDireccion_estudiante)").toString());
                    }
                    alumno.insertaralumno(t_NoCarne.getText(), t_Nombres.getText(), t_Apellidos.getText(), 
                                          fechaNac, ec, cb_NoOrden.getSelectedItem().toString(), Integer.parseInt(t_Registro.getText()), 
                                          null, max);
                    
                    
                    if(t_Casa.getText().isEmpty() == false)
                    {
                        
                        alumno.InsertaTelAlumno(t_Casa.getText().trim(), Integer.parseInt(t_NoCarne.getText()) , 1);
                    }
                    if(t_Cel.getText().isEmpty() == false)
                    {
                        alumno.InsertaTelAlumno(t_Cel.getText().trim(), Integer.parseInt(t_NoCarne.getText()) , 2);
                    }
                } 
                catch (SQLException ex) 
                {
                    Logger.getLogger(Ingresar_alumno.class.getName()).log(Level.SEVERE, null, ex);
                }
                JOptionPane.showMessageDialog(null, "Estudiante ingresado exitosamente");
            }
            
                

            
        }
        
        
    }//GEN-LAST:event_jButton1ActionPerformed

    private void t_CasaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_CasaKeyTyped
        char caracter = evt.getKeyChar();
        
        
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE))) {
            evt.consume();
        }
    }//GEN-LAST:event_t_CasaKeyTyped

    private void t_CelKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_CelKeyTyped
        char caracter = evt.getKeyChar();
        
        
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE))) {
            evt.consume();
        }
    }//GEN-LAST:event_t_CelKeyTyped

//GEN-FIRST:event_jTextField6KeyTyped
 
//GEN-LAST:event_jTextField6KeyTyped

    private void t_ZonaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_ZonaKeyTyped
        char caracter = evt.getKeyChar();
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE))) {
            evt.consume();
        }
    }//GEN-LAST:event_t_ZonaKeyTyped

    private void cb_dptoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_dptoActionPerformed
//        int index = cb_dpto.getSelectedIndex();
//        //JOptionPane.showMessageDialog(null, String.valueOf(index));
//        while(true){  
//        try {
//                java.sql.ResultSet rs= alumno.obtenerMunicipio(index + 1);
//                while (rs.next()){
//                    cb_muni.addItem(rs.getObject("Nombre_municipio"));
//                }
//
//                   
//            } catch (SQLException ex) {
//                Logger.getLogger(Ingresar_alumno.class.getName()).log(Level.SEVERE, null, ex);
//            }
//        }
    }//GEN-LAST:event_cb_dptoActionPerformed
    
    private void cb_muniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_muniActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cb_muniActionPerformed

    private void cb_dptoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cb_dptoItemStateChanged
         
         java.sql.ResultSet rs = null ;
         String idDepart = null;
         cb_muni.removeAllItems();
        try {
            rs = alumno.obtenerIdDepartamento(cb_dpto.getSelectedItem().toString());
        } catch (SQLException ex) {
            Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            while (rs.next()){
               idDepart = rs.getObject("idDepartamento").toString();
            }
            idDpto = Integer.parseInt(idDepart);
        } catch (SQLException ex) {
            Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
        }
       
        try {
            java.sql.ResultSet rss= alumno.verMunicipios(idDpto);
            while (rss.next()){
                cb_muni.addItem(rss.getObject("Nombre_municipio"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_cb_dptoItemStateChanged

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Ingresar_alumno().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Cedula_DPI;
    private javax.swing.JComboBox cb_NoOrden;
    private javax.swing.JComboBox cb_año;
    private javax.swing.JComboBox cb_dia;
    private javax.swing.JComboBox cb_dpto;
    private javax.swing.JComboBox cb_mes;
    private javax.swing.JComboBox cb_muni;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JLabel l_Apellidos;
    private javax.swing.JLabel l_Cedula_DPI;
    private javax.swing.JLabel l_EstadoCivil;
    private javax.swing.JLabel l_FechaNac;
    private javax.swing.JLabel l_NoCarne;
    private javax.swing.JLabel l_NoDPI;
    private javax.swing.JLabel l_NoOrden;
    private javax.swing.JLabel l_NoRegistro;
    private javax.swing.JLabel l_Nombres;
    private javax.swing.JRadioButton rb_Casado;
    private javax.swing.JRadioButton rb_Soltero;
    private javax.swing.JTextField t_Apellidos;
    private javax.swing.JTextField t_Casa;
    private javax.swing.JTextField t_Cel;
    private javax.swing.JTextField t_Direccion;
    private javax.swing.JTextField t_NoCarne;
    private javax.swing.JTextField t_NoDPI;
    private javax.swing.JTextField t_Nombres;
    private javax.swing.JTextField t_Registro;
    private javax.swing.JTextField t_Zona;
    // End of variables declaration//GEN-END:variables
}
